% Does the bare minimum of operations to get a larval behavior experiment
% loaded into Matlab, and the tracks segmented.
%
% 
% LOAD FILE(S)
if (~exist('eset','var'))
    eset=ExperimentSet.fromFiles();
end

% CLEAN THE TRACKS
%
existsAndDefault('cleanEset', 'true');
if (cleanEset)
    ecl = ESetCleaner;
    ecl.minHTValid = 0.65;
    ecl.minDist = 50;
    ecl.minSpeed = 0.65;
    ecl.minPts = 1000;
    ecl.clean(eset);
    
    cleanEset = false;
end

% FIX HEAD-TAIL ORIENTATION 
existsAndDefault('fixht','true');
if (fixht)
    eset.executeTrackFunction('fixHTOrientation');
    fixht = false;
end

% 
% SET SEGMENTATION SPEED
existsAndDefault('autosetspeeds', true);
if (autosetspeeds)
    eset.executeTrackFunction('setSegmentSpeeds');
    autosetspeeds = false;
end

% SEGMENT THE TRACKS
existsAndDefault('segment', true);
if (segment)
    eset.executeTrackFunction('segmentTrack');
    segment = false; 
end